# Contributor: Bradley J Chambers <brad.chambers@gmail.com>
# Maintainer: Bradley J Chambers <brad.chambers@gmail.com>
pkgname=py3-pdal
pkgver=3.4.5
pkgrel=0
pkgdesc="PDAL Python bindings"
url="https://github.com/pdal/python"
arch="all"
license="BSD-3-Clause"
depends="python3 py3-numpy"
checkdepends="pdal py3-pytest"
makedepends="python3-dev pdal-dev py3-scikit-build-core py3-numpy-dev cmake ninja py3-pybind11-dev py3-gpep517"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/PDAL/python/archive/$pkgver.tar.gz
	tests.patch
	"
builddir="$srcdir/python-$pkgver"

replaces="py-pdal" # Backwards compatibility
provides="py-pdal=$pkgver-r$pkgrel" # Backwards compatibility

case "$CARCH" in
	# Bus error (core dumped)
	armhf|armv7) options="$options !check" ;;
	# RuntimeError: Bad field specification in numpy array.
	s390x) options="$options !check" ;;
esac

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest test
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
1a84c24924e751f117e17b3b9c1362f854aeacce43744bddef5d05de2080ecf6148b97c50ce245670c8f04e3727422e8fd2aeef00a48f05c58131f686abafadb  py3-pdal-3.4.5.tar.gz
edd1e2b583f3370a86ac87e9e8735c045886b918deb40dccb376d2ed52544a982a00cba3be521c80e4d4f967ed71a437ab8ec2db4cf2de9d4f22e437f7126f41  tests.patch
"
